package com.clayecloud.common.admin.controller;

import com.clayecloud.common.admin.services.ProcessTackingService;
import com.clayecloud.common.annotation.NoAuthorization;
import com.clayecloud.common.annotations.IgnoreSwaggerParameter;
import com.clayecloud.common.entity.ProcessTacking;
import com.clayecloud.common.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/admin/promissionTacking")
@Api(tags = "跟踪表")
public class AdminPromissionTackingController {

    @Resource
    private ProcessTackingService processTackingService;

    @PostMapping("/insert")
    @ApiOperation("增加跟踪事件")
    @NoAuthorization
    public MessageUtil insertPromissionTacking(ProcessTacking processTacking){
        return processTackingService.insertSelective(processTacking);
    }

    @DeleteMapping ("/delete")
    @ApiOperation("删除跟踪事件")
    public MessageUtil deletePromissionTacking(Long processId){
        return processTackingService.deleteByPrimaryKey(processId);
    }

    @PutMapping("/update")
    @ApiOperation("更新跟踪事件")
    public MessageUtil updatePromissionTacking(ProcessTacking processTacking){
        return processTackingService.updateByPrimaryKeySelective(processTacking);
    }

    @GetMapping("/getProgress")
    @ApiOperation("获取进度信息 track_id type:报事报修")
    @NoAuthorization
    public MessageUtil getProgress(Long trackId, Integer trackType){
        return processTackingService.selectBytrackIdAndType(trackId, trackType);
    }

}
